//package com.cbest.bee.rbac.server.filter;
//
//
//import java.io.IOException;
//
//import javax.servlet.FilterChain;
//import javax.servlet.ServletException;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//
//import org.springframework.core.annotation.Order;
//import org.springframework.stereotype.Component;
//import org.springframework.web.filter.OncePerRequestFilter;
//
//@Order(Integer.MIN_VALUE)
//@Component
//public class CrosFilter extends OncePerRequestFilter {  
//
//	@Override
//	protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
//
//		HttpServletResponse res = (HttpServletResponse) response;
//		HttpServletRequest req = (HttpServletRequest) request;
//		String origin = req.getHeader("Origin");
//		if (!org.springframework.util.StringUtils.isEmpty(origin)) {
//			res.addHeader("Access-Control-Allow-Origin", origin);			
//		}
//		res.setHeader("Access-Control-Expose-Headers","*");
//		res.addHeader("Access-Control-Allow-Methods", "*");
//		String headers = req.getHeader("Access-Control-Request-Headers");
//		// 支持所有自定义头
//		if (!org.springframework.util.StringUtils.isEmpty(headers)) {
//			res.addHeader("Access-Control-Allow-Headers", headers);			
//		}
//		res.addHeader("Access-Control-Max-Age", "3600");
//		res.addHeader("Access-Control-Allow-Credentials", "true");
//		doFilter(request, response, filterChain);
//		
//	}
//
//}
